home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / fpointarray.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-09-23  |  4.2 KB  |  97 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8.                           fpointarray.h  -  description
  9.                              -------------------
  10.     begin                : Mit Jul 24 2002
  11.     copyright            : (C) 2002 by Franz Schmid
  12.     email                : Franz.Schmid@altmuehlnet.de
  13.  ***************************************************************************/
  14.  
  15. /***************************************************************************
  16.  *                                                                         *
  17.  *   This program is free software; you can redistribute it and/or modify  *
  18.  *   it under the terms of the GNU General Public License as published by  *
  19.  *   the Free Software Foundation; either version 2 of the License, or     *
  20.  *   (at your option) any later version.                                   *
  21.  *                                                                         *
  22.  ***************************************************************************/
  23.  
  24. #ifndef FPOINTARRAY_H
  25. #define FPOINTARRAY_H
  26.  
  27. #include <QMatrix>
  28. #include <QPainterPath>
  29. #include <QPoint>
  30. #include <QPointF>
  31. #include <QVector>
  32.  
  33. #include "fpoint.h"
  34. #include "scribusapi.h"
  35.  
  36. /**
  37.   *@author Franz Schmid
  38.   */
  39.  
  40. struct SVGState;
  41.  
  42. class SCRIBUS_API FPointArray : private QVector<FPoint>
  43. {
  44. public: 
  45.     FPointArray() : count(0), capacity(0), svgState(NULL) {};
  46.     FPointArray(int size) : QVector<FPoint>(size), count(size), capacity(size), svgState(NULL) {};
  47.     FPointArray(const FPointArray &a) : QVector<FPoint>(a), count(a.count), capacity(a.capacity), svgState(NULL) {};
  48.     uint size() const { return count; };
  49.     bool resize(uint newCount);
  50.     void setPoint(uint i, double x, double y) { Iterator p = begin(); p+=i; p->xp = x; p->yp = y; };
  51.     void setPoint(uint i, FPoint p) {    setPoint(i, p.xp, p.yp); };
  52.     bool setPoints( int nPoints, double firstx, double firsty, ... );
  53.     bool putPoints( int index, int nPoints, double firstx, double firsty,  ... );
  54.     bool putPoints( int index, int nPoints, const FPointArray & from, int fromIndex = 0 );
  55.     void point(uint i, double *x, double *y) const;
  56.     const FPoint & point(uint i)  const{ ConstIterator p = begin(); p+=i; return *p; };
  57.     QPoint pointQ(uint i) const;
  58.     QPointF pointQF(uint i) const;
  59.     void translate( double dx, double dy );
  60.     void scale( double sx, double sy );
  61.     FPoint WidthHeight() const;
  62.     void map(QMatrix m);
  63.     FPointArray &operator=( const FPointArray &a );
  64.     FPointArray copy() const;
  65.     void setMarker();
  66.     void addPoint(double x, double y);
  67.     void addPoint(FPoint p);
  68.     bool hasLastQuadPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) const;
  69.     void addQuadPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4);
  70.     void addQuadPoint(FPoint p1, FPoint p2, FPoint p3, FPoint p4);
  71.     double lenPathSeg(int seg) const;
  72.     double lenPathDist(int seg, double t1, double t2) const;
  73.     void pointTangentNormalAt( int seg, double t, FPoint* p, FPoint* tn, FPoint* n ) const;
  74.     void pointDerivativesAt( int seg, double t, FPoint* p, FPoint* d1, FPoint* d2 ) const;
  75.     bool operator==(const FPointArray &rhs) const;
  76.     bool operator!=(const FPointArray &rhs) const;
  77.     ~FPointArray();
  78.     void svgInit();
  79.     void svgMoveTo(double x, double y);
  80.     void svgLineTo(double x, double y);
  81.     //void svgCurveTo(double x1, double y1, double x2, double y2);
  82.     void svgCurveToCubic(double x1, double y1, double x2, double y2, double x3, double y3);
  83.     void svgArcTo(double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, double x1, double y1);
  84.     void svgClosePath();
  85.     void calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag);
  86.     bool parseSVG(const QString& svgPath);
  87.     QString svgPath() const;
  88.     QPainterPath toQPainterPath(bool closed);
  89.     void fromQPainterPath(QPainterPath &path);
  90. private:
  91.     uint count;
  92.     uint capacity;
  93.     SVGState * svgState;
  94. };
  95.  
  96. #endif
  97.